/* 身份证 */
function onIDCardsValidation(e) {
    if (e.isValid) {
       	var pattern = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;
        if (e.value!='' && pattern.test(e.value) == false) {
        	e.errorText = "身份证格式不正确";
            e.isValid = false;
        }
    }
}

/* 是否汉字 */
function isChinese(v) {
    var re = new RegExp("^[\u4e00-\u9fa5]+$");
    if (re.test(v)) return true;
    return false;
}

function onChineseValidation(e) {
    if (e.isValid) {
        if (isChinese(e.value) == false) {
            e.errorText = "必须输入中文";
            e.isValid = false;
        }
    }
}

/* 手机 */
function onPhoneValidation(e) {
    if (e.isValid) {
        var pattern = /^(1(([35][0-9])|(47)|[8][01236789]))\d{8}$/;
        if (pattern.test(e.value) == false) {
            e.errorText = "手机号格式不正确";
            e.isValid = false;
        }
    }
}

/*miniui自定义vtype*/
mini.VTypes["ipErrorText"] = "请输入IP地址";
mini.VTypes["ip"] = function (v) {
    var re = new RegExp("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}");
    if (re.test(v)) return true;
    return false;
}